<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">

  <link rel="stylesheet" type="text/css" href="static/css/bootstrap.min.css">
  <!--包含图标库-->
  <link rel="stylesheet" href="static/css/bootstrap-table.css">
  <script src="static/js/jquery-2.1.4.min.js"></script>
  <script src="static/js/bootstrap.min.js"></script>

  <script src="static/js/bootstrap-table.js"></script>
  <script src="static/js/bootstrap-table-export.js"></script>
  <script src="static/js/jquery.base64.js"></script>
  <script src="static/js/tableExport.js"></script>

</head>

<body>

    <div id="reportTableDiv" class="span10" >
      <table id="reportTable">
      </table>
    </div>



<script type="text/javascript">

  var data = [{
    "userSchool": "",
    "userStudentNumber": "",
    "userName": "",
    "userSex": "",
    "userMajor": "",
    "userClass": "",
    "userScore": "",
  }];

  $(function() {

    $('#reportTable').bootstrapTable({
      method: 'post',
      cache: false,
      height: 700,
      width: 1000,
      striped: true,
      pagination: true,
      pageSize: 20,
      pageNumber: 1,
      pageList: [10, 20, 50, 100, 200, 500],
      search: true,
      showColumns: true,
      showRefresh: true,
      showExport: true,
      exportTypes: ['excel'],
      clickToSelect: true,
      columns: [{
        field: "userSchool",
        title: "学校",
        align: "center",
        valign: "middle",
        sortable: "true"
      },
        {
          field: "userStudentNumber",
          title: "学号",
          align: "center",
          valign: "middle",
          sortable: "true"
        },
        {
          field: "userName",
          title: "姓名",
          align: "center",
          valign: "middle",
          sortable: "true"
        },
        {
          field: "userSex",
          title: "性别",
          align: "center",
          valign: "middle",
          sortable: "true"
        },
        {
          field: "userMajor",
          title: "专业",
          align: "center",
          valign: "middle",
          sortable: "true"
        },
        {
          field: "userClass",
          title: "年级",
          align: "center",
          valign: "middle",
          sortable: "true"
        },
        {
          field: "userScore",
          title: "成绩",
          align: "center",
          valign: "middle",
          sortable: "true"
        }
      ],
      url: "/getScoreAll",
      data: data,
      onPageChange: function(size, number) {
        console.log("页面发生了变化")
      },
    });

    $(window).resize(function() {
      $('#reportTable').bootstrapTable('resetView');
    });
  });

  // $.ajax({
  //   type: 'post',
  //   url: "/getScoreAll",
  //   success: function (reslut) {
  //     console.log(reslut);
  //     data = reslut;
  //   }
  // });

</script>

</body>
</html>